package websocker;

import java.util.*;

/**
 * Created by Jun on 2017/1/16.
 */
public class WebsocketTool {
    public static List getTopList(Map<String,Integer> hs){
        List<Map.Entry<String, Integer>> list =
                new ArrayList<Map.Entry<String, Integer>>(hs.entrySet());
        Collections.sort(list, new Comparator<Map.Entry<String, Integer>>() {
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                //return (o2.getValue() - o1.getValue());
                return (o2.getValue().compareTo(o1.getValue()));
            }
        });

        return list;
    }
}
